<?php
session_start();
if (empty($_SESSION['username'])) {
    echo '<script type="text/javascript">window.location.href="../index.php";</script>';
} else {
    $now = time();
    if ($now > $_SESSION['expire']) {
        session_destroy();
        echo '<script type="text/javascript">var r=confirm("Session expire (30 mins)!"); if(r==true){window.location.href="../index.php";}else{window.location.href="index.php";}</script>';
    } else {
        require '../model-db-connection/config.php';
        $config = require '../model-db-connection/qrc_conf.properties.php';
    }
}
?>
<table width="100%">
    <tr>
        <td align="right" style="width:250px">Team Code (หมายเลขทีมช่าง):</td>
        <td align="left" style="width:250px"><input type="text" class="form-control" id="team_code_search"></td>
        <td align="right" style="width:250px">Team Name (ชื่อทีม):</td>
        <td align="left" style="width:250px"><input type="text" class="form-control" id="team_name_search"></td>
    </tr>
    <tr>
        <td align="right" style="width:250px">Team Leader (หัวหน้าทีม):</td>
        <td align="left" style="width:250px">
            <select class="form-control" id="team_lead_search" name="team_lead_search">
                <option value=""></option>
                <?php
                $sqlSelectMemType = "SELECT * FROM QRC_MEMBERS WHERE memRole ='60004';";
                $resultSets = mysql_query($sqlSelectMemType);
                while ($row = mysql_fetch_array($resultSets)) {
                    echo '<option value="' . $row['memID'] . '">' . $row['memName'] . '</option>';
                }
                ?>
            </select>
        </td>
        <td align="right" style="width:250px"></td>
        <td align="left" style="width:250px"></td>
    </tr>
    <tr>
        <td align="right" style="width:250px">Type of Service (ประเภทของบริการ):</td>
        <td align="left" style="width:250px" colspan="4">
            <select title="Basic example" multiple="multiple" name="type_of_service" id="select2_2" size="5">
                <?php
                $sqlSelectProjectType = "SELECT * FROM QRC_TYPE_OF_SERVICE;";
                $resultSet = mysql_query($sqlSelectProjectType);
                while ($row = mysql_fetch_array($resultSet)) {
                    echo '<option value="' . $row['service_id'] . '">' . $row['service_name'] . '</option>';
                }
                ?> 
            </select>
        </td>
    </tr>
    <tr>
        <td align="right" style="width:250px">Team Type (ประเภททีม):</td>
        <td align="left" style="width:250px">
            <select class="form-control" id="team_type_search" name="team_type_search">
                <option value=""></option>
                <option value="M">M (Main team)</option>
                <option value="S">S (Sub team)</option>
                <option value="T">T (Temporary)</option>
            </select>
        </td>
        <td align="right" style="width:250px">Team Manager (ผู้จัดการทีม):</td>
        <td align="left" style="width:250px">
            <select class="form-control" id="team_t_manager_search" name="team_t_manager_search">
                <option value=""></option>
                <?php
                $sqlSelectMemType = "SELECT * FROM QRC_MEMBERS WHERE memRole ='60003';";
                $resultSets = mysql_query($sqlSelectMemType);
                while ($row = mysql_fetch_array($resultSets)) {
                    echo '<option value="' . $row['memID'] . '">' . $row['memName'] . '</option>';
                }
                ?>
            </select>
        </td>
    </tr>
    <tr>
        <td align="right" style="width:250px">Maximun Search Records:</td>
        <td align="left" style="width:250px">
            <select class="form-control" id="project_limit_search" name="project_limit_search">
                <option value="100">100</option>
                <option value="500">500</option>
                <option value="1000">1000</option>
                <option value="All">--All--</option>                                                       
            </select>
        </td>
    </tr>
</table>


<script type="text/javascript" src="../js/bootstrap-datepicker.js"></script>
<link rel="stylesheet" type="text/css" href="../css/datepicker.css" media="screen" />
<script type="text/javascript">
    $(document).ready(function() {
        $("#select2_2").multiselect({
            selectedList: 1 // 0-based index
        });
    });
</script>
